home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / DClap / DControl.h < prev    next >
Text File  |  1996-07-05  |  4KB  |  150 lines

  1. // DControl.h
  2. // d.g.gilbert
  3.  
  4. #ifndef _DCONTROL_
  5. #define _DCONTROL_
  6.  
  7. #include "Dvibrant.h"
  8. #include "DView.h"
  9.  
  10. class DList;
  11.  
  12. class DControl : public DView
  13. {    
  14. public:
  15.     DControl(long id, DView* itsSuperior) :
  16.         DView( id, NULL, kControl, itsSuperior) 
  17.         {}
  18. };
  19.  
  20.  
  21. class DPrompt : public DControl
  22. {    
  23. public:
  24.     Nlm_PrompT    fPrompt;
  25.     DPrompt(long id, DView* itsSuperior, char* title, short pixwidth = 0, short pixheight = 0, 
  26.         Nlm_FonT font = Nlm_programFont, Justify just = justleft);
  27. };
  28.  
  29.  
  30. class DCluster : public DControl
  31. {    
  32. public:
  33.     static Nlm_FonT    fFont;
  34.     Nlm_GrouP fGroup;
  35.     
  36.     DCluster(long id, DView* itsSuperior, 
  37.             short width, short height, Boolean hidden = false, char* title = NULL);
  38.     virtual ~DCluster();
  39.     static void SetFont(Nlm_FonT theFont);
  40.     void SetMargins(short xMargin, short yMargin) {
  41.         Nlm_SetGroupMargins( fGroup, xMargin, yMargin);
  42.         }
  43.     void SetSpacing(short xSpacing, short ySpacing) {
  44.         Nlm_SetGroupSpacing( fGroup, xSpacing, ySpacing);
  45.         }
  46. };
  47.  
  48.  
  49. class DButton : public DControl
  50. {    
  51. public:
  52.     Nlm_ButtoN fButton;
  53.     DButton(long id, DView* itsSuperior, char* title = NULL);
  54. };
  55.  
  56. class DDefaultButton : public DControl
  57. {    
  58. public:
  59.     Nlm_ButtoN fButton;
  60.     DDefaultButton(long id, DView* itsSuperior, char* title = NULL);
  61. };
  62.  
  63. class DCheckBox : public DControl
  64. {    
  65. public:
  66.     Nlm_ButtoN fButton;
  67.     DCheckBox(long id, DView* itsSuperior, char* title = NULL);
  68. };
  69.  
  70. class DRadioButton : public DControl
  71. {    
  72. public:
  73.     Nlm_ButtoN fButton;
  74.     DRadioButton(long id, DView* itsSuperior, char* title = NULL);
  75. };
  76.  
  77.  
  78. class DPopupList : public DControl
  79. {    
  80. public:
  81.     Nlm_PopuP    fPopup;
  82.     DList*    fItemList;
  83.     DPopupList(long id, DView* itsSuperior, Boolean macLike = true);
  84.     ~DPopupList();
  85.     virtual void AddItem(char* title, char* value= NULL);
  86.     virtual char* GetSelectedItem( short& item, char* name, ulong namesize);
  87.     virtual char* GetSelectedValue( short& item, char* name, ulong namesize);
  88.     virtual char* GetItemTitle( short item, char* title = NULL, ulong maxsize = 256)
  89.         {  return GetItemTitleOrValue( item, title, maxsize, false); }
  90.     virtual char* GetItemValue( short item, char* title = NULL, ulong maxsize = 256)
  91.         {  return GetItemTitleOrValue( item, title, maxsize, true); }
  92. protected:
  93.     virtual char* GetItemTitleOrValue( short item, char* title = NULL, 
  94.                                     ulong maxsize = 256, Boolean getval2= false);
  95. };
  96.  
  97.  
  98.  
  99. class DListBox : public DControl
  100. {    
  101. public:
  102.     Nlm_LisT fListBox;
  103.     DListBox(long id, DView* itsSuperior, short width, short height, 
  104.             Boolean multiselection = false);
  105.  
  106.     void Append( char* title) { Nlm_ListItem( fListBox, title); }
  107.     void StartAppending() { this->Disable(); }
  108.     void DoneAppending()  { this->Enable(); }
  109. };
  110.  
  111.  
  112. class DRepeatButton : public DControl
  113. {    
  114. public:
  115.     Nlm_RepeaT fRepeater;
  116.     DRepeatButton(long id, DView* itsSuperior, char* title);
  117.     virtual void ClickAt( Nlm_PoinT mouse);
  118. };
  119.  
  120.  
  121.  
  122.  
  123. class DScrollBar : public DControl
  124. {    
  125. public:
  126.     Nlm_BaR fScrollbar;
  127.     DScrollBar(long id, DView* itsSuperior, short width, short height);
  128.  
  129.     virtual void Scroll(DView* scrollee, short newval, short oldval);
  130.     
  131.     void SetValue(short val) { Nlm_CorrectBarValue( fScrollbar, val); }
  132.     void SetMax(short max)   { Nlm_CorrectBarMax( fScrollbar, max); }
  133.     void SetPage(short pgUp, short pgDn) { Nlm_CorrectBarPage(fScrollbar, pgUp, pgDn); }
  134. };
  135.  
  136.  
  137. class DSwitchBox : public DControl
  138. {    
  139. public:
  140.     Nlm_SwitcH fSwitch;
  141.     DSwitchBox(long id, DView* itsSuperior, Boolean displayTextOfValue = false, 
  142.                         Boolean vertical = true);
  143.     virtual void Switch(short newval, short oldval);
  144.     void SetMax(short max) { Nlm_SetSwitchMax( fSwitch, max); }
  145.     short GetMax() { return Nlm_GetSwitchMax(fSwitch); }
  146.     void SetValues(short value, short max) { Nlm_SetSwitchParams(fSwitch, value, max); }
  147. };
  148.  
  149. #endif
  150.